package org.wyy.service;

import org.springframework.stereotype.Component;
import org.wyy.tcc.TccService;
import org.wyy.tcc.TransactionalContext;

/**
 * TCC模式修改库存
 *
 * @author wangyuanye
 * @date 2024/7/22
 **/
@Component
public class TccEditInventory implements TccService {
    @Override
    public boolean tryOperation(TransactionalContext context) {
        // 修改库存
        return true;
    }

    @Override
    public boolean confirmOperation(TransactionalContext context) {
        // 查询以确认本地事务执行成功,假设成功
        return true;
    }

    @Override
    public boolean cancelOperation(TransactionalContext context) {
        // 事务补偿
        return true;
    }
}
